Skip to content

vpn: on Windows force NLMTU on tun interface after creation - #237

Merged
pymq merged 1 commit into
masterfrom
fix/windows-mtu
May 16, 2026
Merged

vpn: on Windows force NLMTU on tun interface after creation#237
pymq merged 1 commit into
masterfrom
fix/windows-mtu

Conversation

@pymq

@pymq pymq commented May 15, 2026

Copy link
Copy Markdown
Member

tun.CreateTUNWithRequestedGUID only stores the requested MTU in wireguard-go's internal forcedMTU field — it does not push the value to the Windows IP stack. As a result wintun's default NLMTU of 65535 (WINTUN_MAX_IP_PACKET_SIZE) stays active, local applications see a 65535-byte interface MTU and send oversized packets, which are then silently dropped by the size check in ReadTUNPackets. This broke streaming and P2P apps (Sunshine/Moonlight) on affected machines.

Force NLMTU explicitly via winipcfg.IPInterface(family).Set() — the same path the official wireguard-windows tunnel uses. Use a short retry loop because the IP interface row briefly returns ERROR_NOT_FOUND right after adapter creation. Read NLMTU back after Set() and warn on mismatch, to surface third-party LWF filters or Windows 11 MTU regressions that can silently override the value.

Fixes #236

tun.CreateTUNWithRequestedGUID only stores the requested MTU in wireguard-go's internal forcedMTU field — it does not push the value to the Windows IP stack. As a result wintun's default NLMTU of 65535 (WINTUN_MAX_IP_PACKET_SIZE) stays active, local applications see a 65535-byte interface MTU and send oversized packets, which are then silently dropped by the size check in ReadTUNPackets. This broke
streaming and P2P apps (Sunshine/Moonlight) on affected machines.

Force NLMTU explicitly via winipcfg.IPInterface(family).Set() — the same path the official wireguard-windows tunnel uses. Use a short retry loop because the IP interface row briefly returns ERROR_NOT_FOUND right after adapter creation. Read NLMTU back after Set() and warn on mismatch, to surface third-party LWF filters or Windows 11 MTU regressions that can silently override the value.
@pymq
pymq merged commit a51f678 into master May 16, 2026
19 of 21 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Incorrect default MTU 65535 on Windows

1 participant